package week8;

import java.util.regex.*;
public class endDemo {
    public static void main(String []args){
        Pattern pt = Pattern.compile(".*?foo");
        Matcher mc = pt.matcher("xfooxxxxxfoo");
        while(mc.find()) {
            String s =  String.format("从索引 %d 到索引 %d 找到符合文字： \"%s\"%n",mc.start(),mc.end(),mc.group());
            System.out.println(s);

        }
    }
}
